package com.sjzxywlkj.cplife.alipay.result;

import java.util.HashMap;
import java.util.Map;

import com.alipay.api.AlipayApiException;
import com.alipay.api.response.AlipayEcoCplifeBasicserviceInitializeResponse;
import com.alipay.api.response.AlipayEcoCplifeBasicserviceModifyResponse;
import com.sjzxywlkj.cplife.alipay.conn.BasicserviceConn;
import com.sjzxywlkj.cplife.alipay.request.entity.BasicserviceInitialize;
import com.sjzxywlkj.cplife.alipay.request.entity.BasicserviceModify;
import com.sjzxywlkj.cplife.alipay.response.entity.BasicserviceInitializeResult;
import com.sjzxywlkj.cplife.alipay.response.entity.BasicserviceModifyResult;
import com.sjzxywlkj.cplife.alipay.response.entity.PublicParameters;

/**
 * 初始化小区操作返回结果
 */
public class BasicserviceAlipay {

    //初始化小区物业基础服务
    public static Map<String, Object> initialize(BasicserviceInitialize basicserviceInitialize, String app_auth_token) throws AlipayApiException {

        AlipayEcoCplifeBasicserviceInitializeResponse response = BasicserviceConn.initialize(basicserviceInitialize, app_auth_token);


        Map<String, Object> result = new HashMap<String, Object>();
        PublicParameters parameters = new PublicParameters(response.getCode(), response.getMsg(), response.getSubCode(), response.getSubMsg(), null);
        BasicserviceInitializeResult basicserviceInitializeResult = new BasicserviceInitializeResult(response.getStatus(), response.getNextAction(), response.getBillPayAuthUrl());
        result.put("parameters", parameters);
        result.put("basicserviceInitializeResult", basicserviceInitializeResult);
        return result;


    }

    // 修改小区物业基础服务信息
    public static Map<String, Object> modify(BasicserviceModify basicserviceModify, String app_auth_token) throws AlipayApiException {
        AlipayEcoCplifeBasicserviceModifyResponse response = BasicserviceConn.modify(basicserviceModify, app_auth_token);

        Map<String, Object> result = new HashMap<String, Object>();
        PublicParameters parameters = new PublicParameters(response.getCode(), response.getMsg(), response.getSubCode(), response.getSubMsg(), null);
        BasicserviceModifyResult basicserviceModifyResult = new BasicserviceModifyResult(response.getStatus(), response.getNextAction());
        result.put("parameters", parameters);
        result.put("basicserviceModifyResult", basicserviceModifyResult);
        return result;

    }
}
